f = open("test.txt", "w")
f.write('jjjjjjj')
f.close()

f = open('test.txt', 'a')
f.write('aaaaaa\n')
f.write('bbbbbbbbb\n')
f.write('ccccccccccccc\n')
f.write('你好红红火火恍恍惚惚\n')
f.close()

# f = open('test.txt', 'r')
# # print(f.read(2))
#
# # for line in f:
# #     print(line, end='')
#
# lines = f.readlines()
# print(lines)
# f.close()

# 上下文管理器
with open('test.txt', 'r',encoding='GBK') as f:
    lines = f.readlines()
    print(lines)